package sk.isomi.helpers;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class NumericHelper {
	
	/**
	 * Round double value.
	 * @param number Number to be rounded.
	 * @param scale <b>Rounding scale</b>
	 * @return Rounded double value
	 */
	public static double roundNumber(double number, int scale) {
		BigDecimal bigDecimal = new BigDecimal(number);		
		BigDecimal roundedBD = bigDecimal.setScale(scale, RoundingMode.HALF_DOWN);
				
		return roundedBD.doubleValue();
	}
	
}
